import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/index/Index.vue'
import Hello from '@/components/HelloWorld'
import Course from '@/components/course/Course'
import Bottom from '@/components/Bottom'
import Outline from '@/components/outline/CourseOutline'
import out1 from '@/components/outline/out1'
import out2 from '@/components/outline/out2'
import login2 from '@/components/login/blogin'
import SVIP from '@/components/SVIP'
import failure from '@/components/failure'
import BackStage from '@/components/backstage/backstageManage'
import Recruit from '@/components/teacher_recruit/Recruit'
import step from '@/components/teacher_recruit/step'
import ApplyOne from '@/components/teacher_recruit/ApplyOne'
import ApplyTwo from '@/components/teacher_recruit/ApplyTwo'
import ApplyThree from '@/components/teacher_recruit/ApplyThree'
import webSet from '@/components/web_set/webSet'
import CourseOrder from '@/components/backstage/changyonggongneng/courseorder'
import BackStage1 from '@/components/backstage/DashBoard'
import headgps from '@/components/backstage/shouyeguanli/headgps'
import blogroll from '@/components/backstage/shouyeguanli/blogroll'
import precinctqu from '@/components/backstage/shouyeguanli/precinctqu'
import bottompage from '@/components/backstage/shouyeguanli/bottompage'
import management from '@/components/backstage/shouyeguanli/management'
import liebiao from '@/components/backstage/coursemanager/liebiao.vue'
import fenlei from '@/components/backstage/coursemanager/fenlei.vue'
import check from '@/components/backstage/coursemanager/check.vue'
import UserManagement from '@/components/backstage/quanxianguanli/UserManagement'
import AdminRole from '@/components/backstage/quanxianguanli/AdminRole'
import MenuManage from '@/components/backstage/quanxianguanli/MenuManage'
import sharebenefit from '@/components/backstage/teacher/sharebenefit'
import Student from '@/components/backstage/xueyuanguanli/Student'
import teacherAudit from '@/components/backstage/teacher/teacherAudit'
import zonecourse from '@/components/backstage/shouyeguanli/zonecouse'
import teacher from '@/components/backstage/teacher/teacher'
import AppAdministration from '@/components/backstage/platform/AppAdministration'
import pay from '@/components/pay'
import video1 from '@/components/gerenzhongxin/ClassHour'
import video2 from '@/components/gerenzhongxin/ChapterManager'
import LoboCourse from '@/components/gerenzhongxin/LuboCourse.vue'
import addCourse from '@/components/gerenzhongxin/addCourse.vue'
import addCourseTwo from '@/components/gerenzhongxin/addCourseTwo.vue'
import PersonInformation from '@/components/PersonalCenter/PersonInformation'
import Changepassword  from '@/components/PersonalCenter/Changepassword'
import PersonalCenterBody  from '@/components/PersonalCenter/PersonalCenterBody'
import myOrder  from '@/components/PersonalCenter/myOrder'
import redPacket  from '@/components/PersonalCenter/redPacket'
import blogin  from '@/components/blogin'
import InCome  from '@/components/teacher_recruit/InCome'
import TeacherInformation  from '@/components/PersonalCenter/TeacherInformation'
import LearningRecord  from '@/components/PersonalCenter/LearningRecord'
import MyCollection  from '@/components/PersonalCenter/MyCollection'
import attention  from '@/components/PersonalCenter/attention'
import myCourses  from '@/components/PersonalCenter/myCourses'
import teacher1  from '@/components/teachercenter(1)'
Vue.use(Router);

//获取原型对象上的push函数
const originalPush = Router.prototype.push;
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};
export default new Router({
  // 跳转路由时回到页面顶部方法二（或者在main。js里配置）
  // scrollBehavior(to,from,saveTop){
  //
  //   if(saveTop){
  //
  //     return saveTop;
  //
  //   }else{
  //
  //     return {x:0,y:0}
  //
  //   } },
  routes: [
    {
      path: '/',
      name: 'Index',
      component:Index,
    }, {
      path: '/teacher1',
      name: 'teacher1',
      component:teacher1,
    },{
      path: '/h',
      name: 'Hello',
      component:Hello,
    },{
      path: '/blogin',
      name: 'blogin',
      component:blogin,
    },{
      path: '/p',
      component:pay,
    },{
      path: '/Course',
      name: 'Course',
      component:Course,
    }
    ,{
      path:'/outline',
      name:'Outline',
      component:Outline,
      // redirect: "out2",
      // redirect: to => {
      //   // console.log(typeof to.params.img);
      //   let type = to.query.type;
      //   return type
      // },
      // // redirect: "out2",
      // redirect: to => {
      //   // console.log(typeof to.params.img);
      //   let type = to.query.type;
      //   return type
      // },
      children:[
        {
          path:'/out1',
          name:'out1',
          component:out1,
        },{
          path:'/out2',
          name:'out2',
          component:out2,
        },
      ]
    },{
      path:'/login2',
      name:'login2',
      component:login2
    },
    {
      path: '/SVIP',
      name: 'SVIP',
      component: SVIP
    },{
      path: '/failure',
      name: 'failure',
      component: failure
    },{
      path: '/backStage',
      name: 'BackStage',
      component: BackStage,
      children: [
        {
          path: '/zonecourse',
          name: 'zonecourse',
          component: zonecourse
        },{
          path: '/Course1',
          name: 'Course',
          component:Course,
        },{
          path: '/l1',
          name: 'Index',
          component:Index,
        },{
          path: '/l2',
          name: 'BackStage1',
          component:BackStage1,
        },{
          path: '/webSet',
          name: 'webSet',
          component: webSet
        },{
          path: '/CourseOrder',
          name: 'CourseOrder',
          component: CourseOrder
        },{
          path:'/headgps',
          name:'headgps',
          component:headgps
        },{
          path:'/blogroll',
          name:'blogroll',
          component:blogroll
        },{
          path:'/precinctqu',
          name:'precinctqu',
          component:precinctqu
        },{
          path:'/bottompage',
          name:'bottompage',
          component:bottompage
        },{
          path:'/management',
          name:'management',
          component:management
        },{
          path:'/liebiao',
          name:'liebiao',
          component:liebiao
        },{
          path:'/fenlei',
          name:'fenlei',
          component:fenlei
        },{
          path:'/check',
          name:'check',
          component:check
        },{
          path:'/Student',
          name:'Student',
          component:Student
        },{
          path:'/sharebenefit',
          name:'sharebenefit',
          component:sharebenefit
        },{
          path:'/teacher',
          name:'teacher',
          component:teacher
        },{
          path:'/teacherAudit',
          name:'teacherAudit',
          component:teacherAudit
        },{
          path: '/UserManagement',
          name: 'UserManagement',
          component: UserManagement
        },{
          path: '/AdminRole',
          name: 'AdminRole',
          component: AdminRole
        },{
          path: '/MenuManage',
          name: 'MenuManage',
          component: MenuManage
        }
      ]
    },{
      path: '/Recruit',
      name: 'Recruit',
      component: Recruit
    },{
      path: '/step',
      name: 'step',
      component: step
    },{
      path: '/ApplyOne',
      name: 'ApplyOne',
      component: ApplyOne
    },{
      path: '/ApplyTwo',
      name: 'ApplyTwo',
      component: ApplyTwo
    },{
      path: '/ApplyThree',
      name: 'ApplyThree',
      component: ApplyThree
    },{
      path: '/AppAdministration',
      name: 'AppAdministration',
      component: AppAdministration
    },{
      path:'/Bottom',
      name:'Bottom',
      component:Bottom
    },{
      path:'/PersonalCenterBody',
      name:'PersonalCenterBody',
      component:PersonalCenterBody,
      children:[
        {
          path: '/PersonInformation',
          name: 'PersonInformation',
          component: PersonInformation
      },{
          path: '/Changepassword',
          name: 'Changepassword',
          component: Changepassword
        },{
          path: '/myOrder',
          name: 'myOrder',
          component: myOrder
        },{
          path: '/redPacket',
          name: 'redPacket',
          component: redPacket
        },{
          path: '/LoboCourse',
          name: 'LoboCourse',
          component: LoboCourse
        },{
          path: '/addCourse',
          name: 'addCourse',
          component: addCourse
        },{
          path: '/addCourseTwo',
          name: 'addCourseTwo',
          component: addCourseTwo
        },{path: '/video1',
          name: 'video1',
          component:video1,},
        {path: '/video2',
          name: 'video2',
          component:video2,},
        {path: '/InCome',
          name: 'InCome',
          component:InCome,},
        {path: '/TeacherInformation',
          name: 'TeacherInformation',
          component:TeacherInformation},
        {path: '/LearningRecord',
          name: 'LearningRecord',
          component:LearningRecord
        },{path: '/MyCollection',
          name: 'MyCollection',
          component:MyCollection
        },{path: '/attention',
          name: 'attention',
          component:attention
        },{path: '/myCourses',
          name: 'myCourses',
          component:myCourses
        }
      ]
    }
  ]
})
